<?#//v.3.1.1
#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('../includes/config.inc.php');
include "loggedin.inc.php";

unset($ERR);

// Check for HTTPS settings
$R = @mysql_query("SELECT * FROM PHPAUCTIONXL_https");
if(!$R) {
	MySQLError($query);
	exit;
} else {
	$HTTPS = @mysql_fetch_array($R);
}

#// Update credit card settings
if($_POST['action'] == "update" && phpa_securepost($_POST)) {
	$query = "UPDATE PHPAUCTIONXL_usersettings SET 
				requested_fields='".serialize($_POST['requested_fields'])."',
				mandatory_fields='".serialize($_POST['mandatory_fields'])."'";
	$res = @mysql_query($query);
	#// Update database
	$query = "update PHPAUCTIONXL_settings set
			      userscreditcard ='".$_POST['userscreditcard']."'";
	$res = mysql_query($query);
	if(!$res)
	{
		print "Error: $query<BR>".mysql_error();
		exit;
	}
	else
	{
		#// Update discount
		$query = "UPDATE PHPAUCTIONXL_usersettings set discount=".doubleval(input_money($_POST['bonus']));
		$RES = mysql_query($query);
		if(!$RES)
		{
			print "Error: $query<BR>".mysql_error();
			exit;
		}
		else
		{
			$ERR = $MSG_5271;
		}
	}
	
}

#//
$query = "SELECT * FROM PHPAUCTIONXL_usersettings";
$rr = mysql_query($query);
if(mysql_num_rows($rr) > 0)
{
	$SETTINGS['discount'] = mysql_result($rr,0,"discount");
	$SETTINGS['requested_fields'] = unserialize(mysql_result($rr,0,"requested_fields"));
	$SETTINGS['mandatory_fields'] = unserialize(mysql_result($rr,0,"mandatory_fields"));
}
?>
<HTML>
<HEAD>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
</HEAD>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
        <tr> 
          <td class="icono"><img src="images/users_icon2.gif" width="17" height="23" ></td>
          <td class="breadcrumbs"><p><span><?=$MSG_25_0010?></span>&nbsp;&gt;&gt;&nbsp;<?=$MSG_5268?></p></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
    <tr> 
    <td align="center" valign="middle">
<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0 BGCOLOR="#FFFFFF">
<TR>
<TD align="center">
	<BR>
	<FORM NAME=conf ACTION=<?=basename($_SERVER['PHP_SELF'])?> METHOD=POST>
		<TABLE WIDTH="95%" BORDER="0" CELLSPACING="0" CELLPADDING="0" class="base" style="border:1px solid #ccc;">
			<TR>
				<TD ALIGN=CENTER class=title>
					<p><? print $MSG_5268; ?></p>
				</TD>
			</TR>
			<TR>
				<TD>

	<TABLE WIDTH=100% ALIGN="CENTER" CELLPADDING=0 cellspacing="0" BGCOLOR="#FFFFFF">
	  <?
	  if(isset($ERR))
	  {
					?>
	  <TR>
		<TD COLSPAN="2" class=error>
		  <? print $ERR; ?>		</TD>
	  </TR>
	  <?
	  }
					 ?>
	  <TR VALIGN="TOP">
		<TD colspan="2">
		 <p> <? print $MSG_5269; ?>
		  <?
		  if($HTTPS[https] == 'yes')
		  {
			print $MSG_5274;
		  }
		  else
		  {
			print $MSG_5275;
		  }
   ?>	</p>	  </TD>
		</TR>
	  <TR VALIGN="TOP">
		<TD WIDTH=125 HEIGHT="22" class="lineV gris">
		<p class="">  <? print $MSG_5270; ?>	</p>	  </TD>
		<TD WIDTH="375" HEIGHT="22" class="gris">
		  <INPUT TYPE="radio" NAME="userscreditcard" VALUE="y" <?if($SETTINGS['userscreditcard'] == "y") print " CHECKED"?>>
		  <? print $MSG_030; ?>
		  <INPUT TYPE="radio" NAME="userscreditcard" VALUE="n" <?if($SETTINGS['userscreditcard'] == "n") print " CHECKED"?>>
		  <? print $MSG_029; ?>		  </TD>
	  </TR>
	
	  <TR VALIGN="TOP">
		<TD WIDTH=125  class="lineV">&nbsp;</TD>
		<TD WIDTH="375">
			
			<?=$MSG_5487?>		</TD>
	  </TR>
	  <TR VALIGN="TOP">
		<TD WIDTH=125 HEIGHT="22" class="lineV gris">
		  <p class="blue"><? print $MSG_5486; ?>	</p>	  </TD>
		<TD WIDTH="375" HEIGHT="22" class="gris">
		  <INPUT TYPE="text" NAME="bonus" SIZE="5" VALUE="<?=print_money_nosymbol(doubleval($SETTINGS['discount']))?>">&nbsp;<?=$SETTINGS['currency']?>		  </TD>
	  </TR>

	  <TR>
		<TD WIDTH=125 class="lineV">
		  <INPUT TYPE="hidden" NAME="action" VALUE="update" /> <INPUT TYPE="hidden" NAME="security" VALUE="<?php echo $_SESSION['security'];?>" />		</TD>
		<TD WIDTH="375">
		  <INPUT TYPE="submit" NAME="act" VALUE="<? print $MSG_530; ?>" class="action">		</TD>
	  </TR>
	  <TR>
		<TD WIDTH=125></TD>
		<TD WIDTH="375"> </TD>
	  </TR>
	</TABLE>
				</TD>
			</TR>
		</TABLE>
		</FORM>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>